<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/




//支付相关
Route::prefix('v1')
    ->namespace('App\Http\Controllers\Wechat')
    ->group(function () {
        Route::post('/wechat/payment/native', 'WechatPaymentController@native')->middleware('auth:sanctum');
        Route::post('/wechat/payment/check_order', 'WechatPaymentController@native')->middleware('auth:sanctum');
        Route::any('/wechat/payment/notify', 'WechatPaymentController@notify');
    });


Route::prefix('v1')
    ->namespace('App\Http\Controllers\Api')
    ->group(function () {
        Route::post('/order/payment/check', 'OrderController@checkOrderStatus')->middleware('auth:sanctum');
        Route::get('/order/payment/order_abandonment', 'OrderController@orderAbandonment');
        Route::get('/payment/type_list', 'PaymentController@typeList');
    });




Route::prefix('v1')
    ->namespace('App\Http\Controllers\Api')
    ->group(function () {
        Route::get('/loan_application/checkStatus', 'LoanApplicationController@checkStatus')->middleware('auth:sanctum');

        Route::post('/loan_application/addNumber', 'LoanApplicationController@addNumber');

        Route::get('/loan_application/delOrder', 'LoanApplicationController@delOrder');


        Route::post('/loan_application/addData', 'LoanApplicationController@addLoan');
        Route::get('/loan_application/ScheduledAllocateTimeUpdate', 'LoanApplicationController@ScheduledAllocateTimeUpdate');
        // 接口登录
        Route::post('/login/send-sms', 'LoginController@sendSmsCode');
        Route::post('/login', 'LoginController@login');
        Route::post('/login/by-sms', 'LoginController@loginBySmsCode');
        Route::post('/register', 'LoginController@register');
        Route::post('/logout', 'LoginController@logout')->middleware('auth:sanctum');

        Route::get('/home', 'HomeController@index');
        Route::get('/privacy', 'HomeController@privacy');
        Route::get('/license', 'HomeController@license');
        Route::get('/rules', 'HomeController@rules');
        Route::get('/about', 'HomeController@about');
        Route::get('/qa', 'HomeController@qa');
        Route::get('/loan', 'LoanController@index');
        Route::get('/loan/{id}', 'LoanController@detail')->middleware('auth:sanctum');
        Route::post('/loan/{id}/take', 'LoanController@take')->middleware('auth:sanctum');
        Route::post('/user/loan/{id}/tag', 'LoanController@saveTag')->middleware('auth:sanctum');
        Route::post('/user/loan/{id}/status', 'LoanController@saveStatus')->middleware('auth:sanctum');

        Route::get('/user/kyc', 'UserController@kyc')->middleware('auth:sanctum');
        Route::post('/user/kyc', 'UserController@saveKyc')->middleware('auth:sanctum');
        Route::get('/user/my-invite', 'UserController@myInvite')->middleware('auth:sanctum');
        Route::get('/user/invite-code', 'UserController@inviteCode')->middleware('auth:sanctum');
        Route::post('/user/invite-image', 'UserController@inviteImage')->middleware('auth:sanctum');
        Route::get('/user/account', 'UserController@account')->middleware('auth:sanctum');
        Route::get('/user/loan', 'UserController@loan')->middleware('auth:sanctum');
        Route::get('/user/loan/{id}', 'UserController@loanDetail')->middleware('auth:sanctum');
        Route::get('/user/loan/{id}/tag', 'LoanController@tag')->middleware('auth:sanctum');
        Route::get('/user/loan/{id}/comment', 'LoanController@comment')->middleware('auth:sanctum');
        Route::post('/user/loan/{id}/comment', 'LoanController@saveComment')->middleware('auth:sanctum');
        Route::get('/user/tag', 'UserController@tag')->middleware('auth:sanctum');
        Route::post('/user/tag', 'UserController@saveTag')->middleware('auth:sanctum');
        Route::get('/user/loan/{id}/telephone', 'UserController@loanTelephone')->middleware('auth:sanctum');
        Route::get('/user/log/money', 'UserController@logMoney')->middleware('auth:sanctum');
        Route::get('/user/log/ticket', 'UserController@logTicket')->middleware('auth:sanctum');

        Route::get('/user/log/withdraw', 'UserController@withdrawList')->middleware('auth:sanctum');
        Route::get('/user/money', 'UserController@money')->middleware('auth:sanctum');
        Route::post('/user/withdraw', 'UserController@withdraw')->middleware('auth:sanctum');
        Route::get('/user/withdraw/processing', 'UserController@processingWithdraw')->middleware('auth:sanctum');
        Route::post('/user/deposit/ticket/balance', 'UserController@depositTicketBybalance')->middleware('auth:sanctum');
        Route::get('/user/deposit/product', 'UserController@depositProduct');

        Route::post('/image/upload', [\App\Http\Controllers\Dashboard\ImageController::class, 'upload'])->middleware('auth:sanctum');

        Route::post('/user/chat/room/msg', 'ChatController@roomMsg')->middleware('auth:sanctum');
        Route::get('/user/chat/room/msg', 'ChatController@roomHistory')->middleware('auth:sanctum');
    });




